// 文章路由模块
const exporess = require('express')
const router = exporess.Router()
const articleHandler = require('../router_handler/articleHandler')
const { add_article_schema, get_article_schema, list_article_schema, update_article_schema } = require('../schema/articleSchema')
const expressJoi = require('@escook/express-joi')

// 新建文章
router.post('/articles', expressJoi(add_article_schema), articleHandler.addArticle)

// 获取单个文章信息
router.get('/articles/:id', expressJoi(get_article_schema), articleHandler.getArticleInfo)

// 更新单个文章信息
router.patch('/articles', expressJoi(update_article_schema), articleHandler.updateArticleInfo)

// 删除单个文章信息
router.delete('/articles/:id', expressJoi(get_article_schema), articleHandler.deleteArticle)

// 获取专栏的文章列表
router.get('/columns/:columnId/articles', expressJoi(list_article_schema), articleHandler.getArticleList)


module.exports = router